import {createRouter, createWebHashHistory, createWebHistory} from 'vue-router'
import Layout from '@/views/Layout/index.vue'
import Dish from '@/views/Dish/index.vue'
import Login from '@/views/Login/index.vue'
import Category from '@/views/Category/index.vue'
import Home from '@/views/Home/index.vue'
import Vip from '@/views/Vip/index.vue'
import Order from "@/views/Order/index.vue";
import MyOrders from "@/views/MyOrders/index.vue";
import Pay from "@/views/pay/index.vue"
import WxLogin from "@/views/Login/components/WxLogin.vue";
import AlipayLogin from "@/views/Login/components/AlipayLogin.vue";
import AddressBook from "@/views/AddressBook/index.vue";
import User from "@/views/User/index.vue";
const router =createRouter({
    history: createWebHashHistory(import.meta.env.BASE_URL),
    routes: [
        {
            path: '/',
            component:Layout,
            children:[
                {
                    path: '',
                    component: Home,
                    children:[
                        {
                            path: 'category/:id',
                            component: Category,
                        }]
                },
                {
                    path: 'dish/:id',
                    component: Dish,
                },
                {
                    path: 'vip',
                    component: Vip,
                },{
                    path: '/myOrders',
                    component: MyOrders,
                },{
                    path: '/order',
                    component: Order,
                },{
                    path: '/pay',
                    component: Pay,
                },{
                    path: '/addressBook',
                    component: AddressBook,
                },{
                    path: '/user',
                    component: User,
                }
            ]
        },{
            path: '/login',
            component: Login,
            children:[
                {
                    path: 'wx_login',
                    component: WxLogin,
                },{
                    path: 'alipay_login',
                    component: AlipayLogin,
                }
            ]
        }
    ]
})
export default router;